Skip to main content

All Questions

6votes
4answers
2kviews

Find all ways to express each of a list of even numbers as the sum of 2 positive, even numbers

This code was a challenge from a friend. Essentially she wanted a way to "Divide an even number into 2 even numbers." So I made this quick and dirty Python program to find the solutions up ...
Omar Morales Rivera's user avatar
1vote
1answer
440views

Finding Mersenne primes

An attempt to find Mersenne primes using the Lucas-Lehmer primality test: ...
LOHO's user avatar
1vote
2answers
418views

Monte-Carlo method to check triangle inequality

This is code for finding if inequality \$abc > 2(\text{area of triangle})\$ where \$a\$, \$b\$ and \$c\$ are the sides of any triangle. The below, and repl, code work as intended. However they ...
iamauser's user avatar
4votes
1answer
549views

Solving a linear system with two variables

Background: Equation 1: 2x-y=6 Equation 2: 4x+3y=22 Because 1 is ax-by=c and 2 is dx-ey=f y=(a * f - c * d) / (a * e - b * d) and x is simply (c - (b * y)) / a) What I am trying to do: ...
kizzer's user avatar
5votes
2answers
1kviews

Magic Square with Five Methods (Python)

Problem Write a program to return a boolean if an input grid is magic square. A magic square of order \$N\$ is an arrangement of \$N^2\$ distinct integers in a square such that the \$N\$ numbers in ...
Emma's user avatar
  • 3,592
1vote
1answer
169views

Project Euler problem 12 Python

I'm new to python and programming in general and I found Project Euler problems a good way to practice python. But my code is pretty slow. It seems to work, didn't wait long enough for the code to ...
RKJ's user avatar
  • 97
5votes
2answers
512views

Find numbers that are palindromic in consecutive number bases

I want to generate numbers which are palindromic in three or more consecutive number bases in the most optimal, fastest way (up to some range). I do not count trivial one digit palindromes. (...
Vepir's user avatar
3votes
2answers
73views

Multithreaded search for solutions to an inequality

This question is related to my previous question on the brute-force search for a solution to an unsolved mathematical inequality: $$3^{k}-2^{k}\left\lfloor \left({\tfrac {3}{2}}\right)^{k}\right\...
esote's user avatar
  • 3,800
7votes
2answers
148views

Finding product palindromes

I am new to perl and want some help in tuning this script if possible cause it takes time if I increased my array. also if I use warnings I get a lot of warnings ...
George Samaan's user avatar
36votes
9answers
7kviews

Solving the Lazy Hobo Riddle

I would like help in optimizing this calculation, which is from the Lazy Hobo Riddle: There once were 4 hoboes travelling across the country. During their journey, they ran short on funds, so ...
user avatar
7votes
4answers
15kviews

Finding the Pythagorean triplet that sums to 1000

Project Euler problem 9 says: A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists ...
Amosa's user avatar
7votes
3answers
12kviews

Determining common divisors of two numbers

Is there a better algorithm for finding the common divisors of two numbers? Can this code be shortened? ...
Razor1692's user avatar
6votes
2answers
1kviews

Simple mathematical console application

I am new to C++ and with my basic knowledge of the language, I have attempted to create a simple console application filled with lots of useful functions involving math related stuff. The following ...
Nick's user avatar
  • 183
10votes
5answers
14kviews

Polynomial program

The program basically takes a polynomial and does some simple calculations with it. With a couple of hours of work I managed to get my first console application to work (aside from the obligatory "...
wizH's user avatar
  • 153

close